Optimal. Leaf size=55 \[ \frac {1}{2} \left (a^2+b^2\right ) x-\frac {(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.01, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps
used = 2, number of rules used = 2, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3152, 8}
\begin {gather*} \frac {1}{2} x \left (a^2+b^2\right )-\frac {(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3152
Rubi steps
\begin {align*} \int (a \cos (c+d x)+b \sin (c+d x))^2 \, dx &=-\frac {(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d}+\frac {1}{2} \left (a^2+b^2\right ) \int 1 \, dx\\ &=\frac {1}{2} \left (a^2+b^2\right ) x-\frac {(b \cos (c+d x)-a \sin (c+d x)) (a \cos (c+d x)+b \sin (c+d x))}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.12, size = 52, normalized size = 0.95 \begin {gather*} \frac {2 \left (a^2+b^2\right ) (c+d x)-2 a b \cos (2 (c+d x))+\left (a^2-b^2\right ) \sin (2 (c+d x))}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 70, normalized size = 1.27
method | result | size |
risch | \(\frac {a^{2} x}{2}+\frac {b^{2} x}{2}-\frac {a b \cos \left (2 d x +2 c \right )}{2 d}+\frac {\sin \left (2 d x +2 c \right ) a^{2}}{4 d}-\frac {\sin \left (2 d x +2 c \right ) b^{2}}{4 d}\) | \(64\) |
derivativedivides | \(\frac {b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-a b \left (\cos ^{2}\left (d x +c \right )\right )+a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(70\) |
default | \(\frac {b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-a b \left (\cos ^{2}\left (d x +c \right )\right )+a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(70\) |
norman | \(\frac {\left (\frac {a^{2}}{2}+\frac {b^{2}}{2}\right ) x +\left (\frac {a^{2}}{2}+\frac {b^{2}}{2}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (a^{2}-b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\left (a^{2}+b^{2}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {\left (a^{2}-b^{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {4 a b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) | \(140\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 68, normalized size = 1.24 \begin {gather*} -\frac {a b \cos \left (d x + c\right )^{2}}{d} + \frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2}}{4 \, d} + \frac {{\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.17, size = 52, normalized size = 0.95 \begin {gather*} -\frac {2 \, a b \cos \left (d x + c\right )^{2} - {\left (a^{2} + b^{2}\right )} d x - {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 128 vs.
\(2 (49) = 98\).
time = 0.09, size = 128, normalized size = 2.33 \begin {gather*} \begin {cases} \frac {a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {a^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {a b \sin ^{2}{\left (c + d x \right )}}{d} + \frac {b^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {b^{2} x \cos ^{2}{\left (c + d x \right )}}{2} - \frac {b^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a \cos {\left (c \right )} + b \sin {\left (c \right )}\right )^{2} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.40, size = 50, normalized size = 0.91 \begin {gather*} \frac {1}{2} \, {\left (a^{2} + b^{2}\right )} x - \frac {a b \cos \left (2 \, d x + 2 \, c\right )}{2 \, d} + \frac {{\left (a^{2} - b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.48, size = 63, normalized size = 1.15 \begin {gather*} \frac {a^2\,x}{2}+\frac {b^2\,x}{2}+\frac {a^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}-\frac {b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}-\frac {a\,b\,\cos \left (2\,c+2\,d\,x\right )}{2\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________